<?
class graphDeviceProcessorUsage extends graphBase {
	protected $rrdFile = 'processor_usage.rrd';
	protected function getOptions() {
		$opts = array(
			'DEF:user='.$this->rrdPath.':user:AVERAGE',
	 		'DEF:nice='.$this->rrdPath.':nice:AVERAGE',
			'DEF:system='.$this->rrdPath.':system:AVERAGE',
			'DEF:idle='.$this->rrdPath.':idle:AVERAGE',
			'CDEF:total=user,nice,system,idle,+,+,+',
			'CDEF:user_perc=user,total,/,100,*',
			'CDEF:nice_perc=nice,total,/,100,*',
			'CDEF:system_perc=system,total,/,100,*',
			'CDEF:idle_perc=idle,total,/,100,*',
			'--lower-limit','0',
			'--upper-limit','100',
			'AREA:user_perc#c02020:user','GPRINT:user_perc:LAST:     %5.2lf%%','GPRINT:user_perc:AVERAGE:   %5.2lf%%','GPRINT:user_perc:MAX:   %5.2lf%%\n',
			'AREA:nice_perc#008f00:nice:STACK','GPRINT:nice_perc:LAST:     %5.2lf%%','GPRINT:nice_perc:AVERAGE:   %5.2lf%%','GPRINT:nice_perc:MAX:   %5.2lf%%\n',
			'AREA:system_perc#ea8f00:system:STACK','GPRINT:system_perc:LAST:   %5.2lf%%','GPRINT:system_perc:AVERAGE:   %5.2lf%%','GPRINT:system_perc:MAX:   %5.2lf%%\n',
			'AREA:idle_perc#efefff11:idle:STACK','GPRINT:idle_perc:LAST:     %5.2lf%%','GPRINT:idle_perc:AVERAGE:   %5.2lf%%','GPRINT:idle_perc:MAX:   %5.2lf%%\n',
			'COMMENT:Usage       Current     Average    Maximum\n'
		);
		if ($this->legend) {
			$opts[] = '-v';
			$opts[] = '% of Total';
		}
		return $opts;
	}
}